home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / nShell™ 1.0.3 / nShell / User's Guide / 04 Pathnames < prev    next >
Encoding:
Text File  |  1994-08-13  |  2.1 KB  |  44 lines  |  [TEXT/ttxt]

  1. 04 Pathnames
  2. ============
  3.  
  4. The nShell(tm) uses traditional Macintosh pathnames to identify files and directories.  In the Macintosh file system the path to a file may be specified as one long name.  Because Macintosh names often have spaces in them, nShell allows the quoting of pathnames.  The command:
  5.  
  6.     cat “my file”
  7.  
  8. would type a file called “my file” from your current directory onto the screen.  When you want to select a file on another disk, the name of the disk is added to the pathname.  The command:
  9.  
  10.     cat “my disk:my file”
  11.  
  12. would type a file called “my file” from “my disk”.  The “:” character is used to tell the Macintosh that you are specifying a path to a file, and not a file in the current directory.
  13.  
  14. If you wanted to identify a file in a specific directory on “my disk”, you would add the name of that directory to the pathname.  The command:
  15.  
  16.     cat “my disk:my folder:my file”
  17.  
  18. would type a file called “my file” from the directory “my folder” on “my disk”.  This is called a full pathname because it specifies every name from the disk name to the file name.
  19.  
  20. You can also specify pathnames relative to your current directory.  If you start a pathname with a “:”, the Macintosh knows that this path starts from your current directory.  The command:
  21.  
  22.     cat “:another folder:my file”
  23.  
  24. would type a file from “another folder” in your current directory.  Because some of this path is implied, it is called a partial pathname.
  25.  
  26. Another form of shorthand may be used with full or partial pathnames.  Using two “:”s in a pathname means "up one directory".  If your current directory is "my disk:my folder", the command:
  27.  
  28.     cat “::my file”
  29.  
  30. would move up from your current directory and type "my file" from “my disk”.
  31.  
  32. Testing Paths
  33. -------------
  34.  
  35. The nShell includes a command called pathchk, which allows you to experiment with pathnames.  When given a pathname, pathchk attempts to print the equivalent full pathname.  For example, if your current directory is “Hard Disk:nShell” and you type the command:
  36.  
  37.     pathchk :bin
  38.  
  39. the response would be:
  40.  
  41.     Hard Disk:nShell:bin
  42.  
  43. The pathchk command does not change any files, and can safely be used to test pathnames before they are used.
  44.